using System;
using System.Data;
using System.Collections;
using System.Text;

using EntLibEC.Cmn;
using System.Transactions;

using EntLibEC.Info.Finance;

using EntLibEC.Dac;
using EntLibEC.Dac.Finance;


namespace EntLibEC.Biz.Finance
{
	/// <summary>
	/// Summary description for NetPayAlipayManager.
	/// </summary>
	public class NetPayAlipayManager
	{
		private NetPayAlipayManager()
		{
		}
		private static NetPayAlipayManager _instance;
		public static NetPayAlipayManager GetInstance()
		{
			if( _instance == null )
			{
				_instance = new NetPayAlipayManager();
			}
			return _instance;
		}

		

		private void map(NetPayAlipayInfo oParam, DataRow tempdr)
		{
			oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]);
			oParam.SOSysNo = Util.TrimIntNull(tempdr["SOSysNo"]);
			oParam.IsCustomerPay = Util.TrimIntNull(tempdr["IsCustomerPay"]);
			oParam.CustomerPayTime = Util.TrimDateNull(tempdr["CustomerPayTime"]);
			oParam.IsNotifyOutStock = Util.TrimIntNull(tempdr["IsNotifyOutStock"]);
			oParam.NotifyOutStockTime = Util.TrimDateNull(tempdr["NotifyOutStockTime"]);
			oParam.IsAccountPaid = Util.TrimIntNull(tempdr["IsAccountPaid"]);
			oParam.AccountPaidTime = Util.TrimDateNull(tempdr["AccountPaidTime"]);
		}
		public void CustomerPay(int soSysNo)
		{
			NetPayAlipayInfo oAlipay = new NetPayAlipayInfo();
			oAlipay.SOSysNo = soSysNo;
			oAlipay.IsCustomerPay = (int)AppEnum.YNStatus.Yes;
			oAlipay.CustomerPayTime = DateTime.Now;

			new NetPayAlipayDac().Insert(oAlipay);
		}
		public void NotifyOutStock(int soSysNo)
		{
			//notify
			// web request, and response
			Hashtable ht = new Hashtable(5);
			ht.Add("SOSysNo", soSysNo);
			ht.Add("IsNotifyOutStock", (int)AppEnum.YNStatus.Yes);
			ht.Add("NotifyOutStockTime", DateTime.Now);
			new NetPayAlipayDac().Update(ht);
		}
		public void AccountPaid(int soSysNo)
		{
			Hashtable ht = new Hashtable(5);
			ht.Add("SOSysNo", soSysNo);
			ht.Add("IsAccountPaid", (int)AppEnum.YNStatus.Yes);
			ht.Add("AccountPaidTime", DateTime.Now);
			new NetPayAlipayDac().Update(ht);
		}
	}
}
